#include "MainDlg.h"


HHOOK CMainDlg::hook; 
//int CMainDlg::keycode;

LRESULT CALLBACK CMainDlg::KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam)
{ 
    if (nCode < 0)  // do not process message 
        return CallNextHookEx(hook, nCode, wParam, lParam); 
 
	LPKBDLLHOOKSTRUCT data = (LPKBDLLHOOKSTRUCT)lParam;

	if((data->vkCode == VK_F2)||(data->vkCode == VK_F3))
	{
		if(WM_KEYDOWN == wParam)
		{
			mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
		
		}
		if(WM_KEYUP == wParam)
		{
			mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);		
		}	
		return 1;//do not chain to others
	}

    
    return CallNextHookEx(hook, nCode, wParam, lParam); 

}